<?php

namespace app\admin\validate;

use think\Validate;

class Banner extends Validate {

    /**
     * 规则定义
     * @var array
     */
    protected $rule = [
        'id'     => 'number',
        'name'   => 'require|min:1|max:30',
        'image'  => 'min:1|max:250',
        'url'    => 'min:1|max:250',
        'status' => 'number',
        'sort'   => 'number|min:1|max:10',
    ];

    /**
     * 提示信息定义
     * @var array
     */
    protected $message = [
        'id'     => 'ID类型错误',
        'name'   => '请输入1-30位字符名称',
        'image'  => '图片地址字符为1-250位',
        'url'    => '图片URL地址字符为1-250位',
        'status' => '轮播图状态必须为正整数',
        'sort'   => '轮播图排序必须为1-10位正整数',
    ];

    /**
     * 场景定义
     * @var array
     */
    public $scene = [
        'operateAjax'      => ['id', 'name', 'image', 'url', 'status', 'sort'],
    ];
}